package com.kaifamiao.demo.d0821;

import java.util.*;

public class Demo {

    public static void main(String[] args) {
        // 工具类
        List list = Collections.EMPTY_LIST;

        System.out.println(list.size());
        System.out.println(list.isEmpty());

        List<Integer> list1 = new ArrayList<>();

//        list1.add(1);
//        list1.add(2);
//        list1.add(2);
        list1.addAll(Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4, 5)));
        Collections.addAll(list1, 1, 2, 3, 4, 5, 6, 1);

        System.out.println(list1);

        LinkedList<Integer> linkedList = new LinkedList<>();

        Collections.addAll(linkedList, 2, 3, 4, 1, 0);

        System.out.println(linkedList);

        // LIFO 队列
        Queue<Integer> queue = Collections.asLifoQueue(linkedList);

        queue.add(9);
        System.out.println(queue);


        // LIFO 栈
        Stack<Integer> stack = new Stack<>();

        stack.push(1);
        stack.push(2);

        System.out.println(stack.peek());
    }
}
